import 'package:appflutterhomeschool/model/tab_model.dart';
import 'package:appflutterhomeschool/utils/sp_util.dart';
import 'package:flutter/material.dart';

import '../my_app_view_model.dart';

///用户： ninetailedfox
///时间： 2020/6/24
///邮箱： 1037438704@qq.com
///功能： 信件页面状态管理

class LetterViewModel extends ChangeNotifier {
  BuildContext me;
  String titleName = "未选择";
  MyAppViewModel myAppViewModel;


  LetterViewModel(this.me, this.myAppViewModel);



  bool unreadBool = false;
  bool identity;

  bool openScreen = false;


  List<TabModel> listTab = [
    TabModel("全部", true),
    TabModel("收藏", false),
  ];

  initView() {

  }

  unreadBoolOnTap() {
    unreadBool = !unreadBool;
    notifyListeners();
  }

  tapModelOnTap(int index) {
    for (int i = 0; i < listTab.length; i++) {
      listTab[i].display = false;
    }
    listTab[index].display = true;
    notifyListeners();
  }

  //是否开启筛选
  onTapOpenScreen() {
    openScreen = !openScreen;
    notifyListeners();
  }


  //获取身份
  getIdentityApplication() async {
    identity = SpUtil.getBool("identity");
    titleName = myAppViewModel.name;
  }

}
